Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!! Migrate to doctrine/migration v3 #23

Merged

Conversation

baschny
Copy link
Contributor

@baschny baschny commented Sep 19, 2023

This completes the open PR #20.

Makes the migrations work again with doctrine/migration v3. See also https://github.com/doctrine/migrations/blob/3.6.x/UPGRADE.md

Changes

  • Implement a DependencyFactory for TYPO3
  • Get rid of DoctrineService
  • Get rid of overwriting the *Command classes from doctrine/migrate which are now final
  • Wire the dependencies in Services.yaml
  • Get rid of obsolete Commands.php
  • Add new commands introduced with doctrine/migrations v3:
    • migrations:dump-schema
    • migrations:generate
    • migrations:latest
    • migrations:list
    • migrations:up-to-date

Compatibility Notes:

  • --dry-run is currently not supported anymore for the "AbstractDataHandlerMigration"
  • An upgrade in the doctrine_migrationstatus is required, see README.md

Resolves #12

* Implement a DependencyFactory for TYPO3
* Get rid of DoctrineService
* Get rid of overwriting the now "final class" *Command from doctrine:migrate
* Wire the dependencies in Services.yaml
* Get rid of obsolete Commands.php
* Add new commands introduced with doctrine/migrations v3:
  - migrations:dump-schema
  - migrations:generate
  - migrations:latest
  - migrations:list
  - migrations:up-to-date

!!! Compatibility Notes:
* `--dry-run` is currently not supported anymore for the "AbstractDataHandlerMigration"
* An upgrade in the doctrine_migrationstatus is required, see README.md
@baschny baschny changed the title !!! Migrate to doctrine/migration v3 way of creating the adaptor !!! Migrate to doctrine/migration v3 Sep 19, 2023
To transform the version column from single version
to fully qualified classname.

See https://github.com/doctrine/migrations/blob/3.6.x/UPGRADE.md
@baschny
Copy link
Contributor Author

baschny commented Nov 14, 2023

@kaystrobach @andreaswolf just FYI, we have been using this branch for some time now in production with success.

@andreaswolf andreaswolf merged commit ef0aef7 into andreaswolf:raise-requirements Nov 22, 2023
17 checks passed
@andreaswolf
Copy link
Owner

@baschny I took your updates and integrated them into the earlier PR #20.

with PHP 8.

After running the Database Compare migrations, don't forget to run the Upgrade Wizards which will
migrate the table `migration_statustable`:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migration_statustable is the name of the wizard, not the table, right? This is not really understandable here IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. But I understand it :)


/**
* Implements a doctrine/migration ConfigurationLoader with a TYPO3 specific flavour
* - Adds
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems there's something missing here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure.. If I recall correctly I changed a lots of things in this loader which I noted when I started to try to document it. And then forgot to come back to it.

By reading the code, I think this description would seem appropriate:

* - Configure table `doctrine_migrationstatus` as where to store our migration status
* - Adds relevant TYPO3 specific paths where to search migrations:
*   1. `var/migrations/` and
*   2. `Migrations/Mysql` paths inside all active extensions

* Migrates the version number in the `doctrine_migrationstatus` table
*
* Transforms version number (i.e. '20230912174700') in column "version"
* to the fully qualified classname as expected for doctrine/migrate v3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… for doctrine/migrations v3, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!

```

This extension uses `doctrine/migrations` to migrate the database tables.
Replace the `@namespace` setting with the namespace of your extension.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which setting? I could not find any other mention of @namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is obsolete, it was overseen and should have been deleted when I introduced the upgrade wizard (which does this automatically). See this commit: ef0aef7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants